<script type="text/javascript"><!--//--><![CDATA[//><!--

	var grid_reload = function(){
		$('#datagrid').datagrid('reload', $('#fm_search').serializeObject());
	};

	$(document).ready(function() {
		// Setup Datagrid
		$('#datagrid').datagrid({  
			url:gs_path+'/'+controller+'/getdata', 
			queryParams: $('#fm_search').serializeObject(),
			height:340,
			pagination:true,
			columns:[[
				{ field : 'ck', checkbox:true, width: 40, align: 'center', rowspan:2},				
				{ field : 'no_surat', title : 'No Surat', width:80, sortable:true, rowspan:2},
				{ field : 'nama_penyelenggara', title : 'Nama Penyelenggara', width:200, sortable:true, rowspan:2},
				{ field : 'alamat', title : 'Alamat', width:150, sortable:true, rowspan:2},
				{ field : 'diwakili_oleh', title : 'Diwakali Oleh', width:120, sortable:true, rowspan:2},
				{ field : 'no_telp', title : 'No Telp', width:120, sortable:true, rowspan:2},
				{ field : 'nama_kegiatan', title : 'Nama Kegiatan', width:170, sortable:true, rowspan:2},
				{ field : 'tanggal_mulai_kegiatan', title : 'Tanggal Mulai Kegiatan', width:150, sortable:true, rowspan:2},
				{ field : 'tanggal_selesai_kegiatan', title : 'Tanggal Selesai Kegiatan', width:150, sortable:true, rowspan:2},
				{ field : 'pukul', title : 'Pukul', width:100, sortable:true, rowspan:2},
				{ field : 'tempat_kegiatan', title : 'Tempat Kegiatan', width:170, sortable:true, rowspan:2},
				{ field : 'catatan_kegiatan', title : 'Catatan Kegiatan', width:170, sortable:true, rowspan:2},
				]
			]
		});


		
		// Set Action Button
		var buttons = [ 

//print pdf
 //print button
					    { label: 'Print PDF', icon: 'print', onclick: function() {
					    	var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
                            window.open(gs_path+'/'+controller+'/cetak/?no_surat='+urlencode(oSel.no_surat), 'myWin', 'height=500,width=700,status=yes,toolbar=no,menubar=yes,location=no,scrollbars=yes');
                        	}
                        }},

		// ----- >> Print Excel Button
                        { label: 'Print Satuan excel', icon: 'print', onclick: function() {

						var oSel = $('#datagrid').datagrid('getSelected');
					        if (oSel == null) {
					            $.messager.alert('&nbsp;', gs_msg_row_unselected, 'warning'); 
					        } else {
								window.location = gs_path + '/pro_print_excel_new/surat_penyelenggara_satuan/?no_surat='+urlencode(oSel.no_surat);
					        } 
							
						}},
					    { label: 'Print Semua', icon: 'print', onclick: function() {
					    	window.location = gs_path + '/pro_print_excel_new/surat_penyelenggara_all';
					    }}];
		setAction(buttons);
		
		
		$('#fm_search').focusFirst();
	});
//--><!]]></script>

<div id="tb" style="padding:5px;height:auto">
    <div>
        <form id="fm_search" onsubmit="grid_reload(); return false;">
        	<table class="tb_form" style="margin-bottom:0px">
            <tr>
            	<td width="100">Keyword</td>
                <td><input type="text" id="keyword" name="keyword" class="textfield medium" />
                	<a href="#" class="easyui-linkbutton" iconCls="icon-search" onclick="grid_reload(); return false;">Search</a>
                </td>
            </tr>
            </table>
        </form>
    </div>
</div>
<div id="datagrid" toolbar="#tb"></div>

